import { baseUrl } from "./config.js"

export function topList(){
	let listIds = ['3','0','2','1']
	return new Promise(function(resole,reject){
		uni.request({
			url:`${baseUrl}/toplist/detail`,
			method:'GET',
			success:res => {
				let result = res.data.list;
				result.length = 4;
				for(var i = 0 ; i< listIds.length;i++){
					result[i].lisId = listIds[i]
				}
				console.log(res,23)
				resole(result)
			},
			fail: () => {
				
			}
		})	
	})
}

export function songList(id){
    return new Promise(function(resole,reject){
		uni.request({
			url:`${baseUrl}/playlist/detail?id=`+id,
			method:'GET',
			success:res => {
				resole(res)
			},
			fail: () => {
				
			}
		})	
	})
}

export function songDetail(songId){
    return new Promise(function(resole,reject){
		uni.request({
			url:`${baseUrl}/song/detail?ids=`+songId,
			method:'GET',
			success:res => {
				resole(res)
			},
			fail: () => {
				
			}
		})	
	})
}

export function songSimi(songId){
    return new Promise(function(resole,reject){
		uni.request({
			url:`${baseUrl}/simi/song?id=`+songId,
			method:'GET',
			success:res => {
				resole(res)
			},
			fail: () => {
				
			}
		})	
	})
}
export function songComment(songId){
    return new Promise(function(resole,reject){
		uni.request({
			url:`${baseUrl}/comment/music?id=`+songId,
			method:'GET',
			success:res => {
				resole(res)
			},
			fail: () => {
				
			}
		})	
	})
}
export function songLyric(songId){
    return new Promise(function(resole,reject){
		uni.request({
			url:`${baseUrl}/lyric?id=`+songId,
			method:'GET',
			success:res => {
				resole(res)
			},
			fail: () => {
				
			}
		})	
	})
}

export function songUrl(songId){
    return new Promise(function(resole,reject){
		uni.request({
			url:`${baseUrl}/song/url?id=`+songId,
			method:'GET',
			success:res => {
				resole(res)
			},
			fail: () => {
				
			}
		})	
	})
}